UserForm = Ext.extend(Ext.Window,
           {
				formPanel : null,
				constructor : function(a) {
					Ext.applyIf(this, a);
					this.initUIComponents();
					UserForm.superclass.constructor.call(this, {
						layout : "fit",
						items : this.formPanel,
						border : false,
						modal : true,
						plain : true,
						id : "UserFormWin",
						title : "会员详细信息",
						iconCls : "menu-role",
						width : 470,
						height : 500,
						minWidth : 300,
						minHeight : 500,
						bodyStyle : "padding:5px;",
						buttonAlign : "center",
						buttons : this.buttons
					});
				},
				initUIComponents : function() {
					this.formPanel = new Ext.FormPanel( {
						url : __ctxPath + "/system/saveUser.do",
						layout : "form",
						id : "UserForm",
						frame : true,
						defaults : {
							widht : 400,
							anchor : "100%,100%"
						},
						formId : "UserFormId",
						defaultType : "textfield",
						items : [ {
							name : "user.id",
							id : "id",
							xtype : "hidden",
							value : this.id
						}, {
							fieldLabel : "账号",
							name : "user.name",
							id : "name"
						}, {
							fieldLabel : "邮箱",
							name : "user.email",
							id : "email"
						}, 
						{
							fieldLabel : "性别",
							name : "user.sex",
							id : "sex"
						}, 
						{
							fieldLabel : "电话",
							name : "user.phone",
							id : "phone"
						},
						{
							fieldLabel : "住址",
							xtype : "textarea",
							name : "user.address",
							id : "address"
						},
						{
							fieldLabel : "会员等级",
							name : "user.userRunk",
							type : "int",
							id : "userRunk"
						},
						{
							fieldLabel : "注册时间",
							name : "user.registerTime",
							id : "registerTime"
						},
						{
							fieldLabel : "最后一次登录时间",
							name : "user.lastLoginTime",
							id : "lastLoginTime"
						},
						{
							fieldLabel : "最后一次登录IP",
							name : "user.lastLoginIp",
							id : "lastLoginIp"
						},
						{
							fieldLabel : "状态",
							name : "user.status",
							id : "status"
						},
						{
							fieldLabel : "会员类型",
							name : "user.userType",
							id : "userType"
						},
						{
							fieldLabel : "邮箱是否已激活",
							name : "user.isValidated",
							id : "isValidated"
						} ]
					});
					if (this.id != null && this.id != "undefined") {
						this.formPanel.getForm().load({
							deferredRender : false,
							url : __ctxPath + "/system/getUser.do?id="+ this.id,
							waitMsg : "正在载入数据...",
							success : function(a, b) {
							},
							failure : function(a, b) {
							}
						});
					}
					this.buttons = [{
								text : "提交",
								iconCls : "btn-save",
								handler : function() {
								    var b = Ext.getCmp("UserForm");
									if (b.getForm().isValid()) {
										b.getForm().submit({
											method : "post",
											waitMsg : "正在提交数据...",
											success : function(c,d) {
												Ext.ux.Toast.msg("操作信息","成功信息保存！");
												Ext.getCmp("UserGrid").getStore().reload();
												Ext.getCmp("UserFormWin").close();
											},
											failure : function(c,d) {
												Ext.MessageBox.show( {
													title : "操作信息",
													msg : "信息保存出错，请联系管理员！",
													buttons : Ext.MessageBox.OK,
													icon : "ext-mb-error"
												});
												Ext.getCmp("UserFormWin").close();
											}
										});
									}
							     }
					  }, {
							text : "取消",
							iconCls : "btn-cancel",
							handler : function() {
								Ext.getCmp("UserFormWin").close();
							}
					  }];
				}
});